﻿using _17单向通道.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

namespace _17单向通道;

public class MyContext:DbContext
{
    public DbSet<User> Users { get; set; }
    public DbSet<Leave> Leaves { get; set;}
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        base.OnConfiguring(optionsBuilder);
        optionsBuilder.UseSqlServer(
            "Server=.;Database=efCorePractice_3;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=true");
        optionsBuilder.LogTo(message =>Console.WriteLine(message),LogLevel.Information);
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
    }
}